﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CMN.BLL;
using CMN.Common;
using CMN.Entity;
using CMN.Models.Interfaces;
namespace CMN.Models
{
    /// <summary>
    /// 模板详细信息Service
    /// </summary>
    public class Normal_TemplateListService: IDataService<Normal_TemplateListEntity>
    {
        /// <summary>
        /// 新增模板详细信息
        /// </summary>
        /// <param name="Normal_TemplateListEntity"></param>
        /// <returns>bool</returns>
        public string Insert(Normal_TemplateListEntity normal_templatelistEntity)
        {
            normal_templatelistEntity.DataTable_Action = DataTableAction.Insert;
            Normal_TemplateList bll = new Normal_TemplateList();
            if (bll.InsertUpdateDelete(normal_templatelistEntity) > 0)
            {
                return "";
            }
            else
            {
                return "失败";
            }
        }

        /// <summary>
        /// 返回模板详细信息查询列表
        /// </summary>
        /// <param name="qp"></param>
        /// <param name="count">查询总个数</param>
        /// <returns>List</returns>
        public List<Normal_TemplateListEntity> List(QueryParam qp,out int count)
        {
            Normal_TemplateList bll = new Normal_TemplateList();
            return bll.List(qp, out count);
        }

        /// <summary>
        /// 更新模板详细信息
        /// </summary>
        /// <param name="Normal_TemplateList"></param>
        /// <returns>bool</returns>
        public string Update(Normal_TemplateListEntity normal_templatelistEntity)
        {
            Normal_TemplateList bll = new Normal_TemplateList();
            normal_templatelistEntity.DataTable_Action = DataTableAction.Update;
            if (bll.InsertUpdateDelete(normal_templatelistEntity) > 0)
            {
                return "";
            }
            else
            {
                return "失败";
            }
        }

        /// <summary>
        /// 删除模板详细信息
        /// </summary>
        /// <param name="Normal_TemplateList"></param>
        /// <returns>bool</returns>
        public string Delete(Normal_TemplateListEntity normal_templatelistEntity)
        {
            Normal_TemplateList bll = new Normal_TemplateList();
            normal_templatelistEntity.DataTable_Action = DataTableAction.Delete;
            if (bll.InsertUpdateDelete(normal_templatelistEntity) > 0)
            {
                return "";
            }
            else
            {
                return "失败";
            }
        }

        /// <summary>
        /// 批量删模板详细信息
        /// </summary>
        /// <param name="idList">删除id列表  2_8_9_45</param>
        /// <returns>bool</returns>
        public string DeleteList(string idList)
        {
            Normal_TemplateList bll = new Normal_TemplateList();
            string[] list =Utils.SplitString(idList,"_");
            string strDel=Utils.ArrayToString(list,",",false);
            if (bll.DelList(strDel) > 0)
            {
                return "";
            }
            else
            {
                return "失败";
            }

        }

        /// <summary>
        /// 返回单个模板详细信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Normal_TemplateListEntity</returns>
        public Normal_TemplateListEntity Look(int id)
        {
            Normal_TemplateList bll = new Normal_TemplateList();
            return bll.Disp(id);
        }
    }
}
